import org.gradle.api.artifacts.dsl.DependencyHandler

object Dependencies {
      const val composeMaterial = "androidx.compose.material3:material3:${Versions.composeMaterial3}"
      const val composeUi = "androidx.compose.ui:ui:${Versions.compose}"
      const val composeUiGraphics = "androidx.compose.ui:ui-graphics:${Versions.compose}"
      const val composeUiTooling = "androidx.compose.ui:ui-tooling:${Versions.compose}"
      const val composeUiToolingPreview = "androidx.compose.ui:ui-tooling-preview:${Versions.compose}"
      const val composeRuntime = "androidx.compose.runtime:runtime:${Versions.compose}"

      const val hiltAndroid = "com.google.dagger:hilt-android:${Versions.hilt}"
      const val hiltCompiler = "com.google.dagger:hilt-android-compiler:${Versions.hilt}"
      const val hiltAgp = "com.google.dagger:hilt-android-gradle-plugin:${Versions.hilt}"

      const val okHttp = "com.squareup.okhttp3:okhttp:${Versions.okHttp}"
      const val okHttpLoggingInterceptor = "com.squareup.okhttp3:logging-interceptor:${Versions.okHttp}"

      const val retrofit = "com.squareup.retrofit2:retrofit:${Versions.retrofit}"
      const val moshiConverter = "com.squareup.retrofit2:converter-moshi:${Versions.retrofit}"

      const val roomRuntime = "androidx.room:room-runtime:${Versions.room}"
      const val roomCompiler = "androidx.room:room-compiler:${Versions.room}"
      const val roomKtx = "androidx.room:room-ktx:${Versions.room}"
}


// 通过扩展函数的方式一次性导入库的所有依赖
fun DependencyHandler.room(){
      implementation(Dependencies.roomKtx)
      implementation(Dependencies.roomRuntime)
      kapt(Dependencies.roomCompiler)
}

fun DependencyHandler.retrofit(){
      implementation(Dependencies.retrofit)
      implementation(Dependencies.moshiConverter)
      implementation(Dependencies.okHttp)
      implementation(Dependencies.okHttpLoggingInterceptor)
}

fun DependencyHandler.compose(){
      implementation(Dependencies.composeUi)
      implementation(Dependencies.composeMaterial)
      implementation(Dependencies.composeRuntime)
      implementation(Dependencies.composeUiTooling)
      implementation(Dependencies.composeUiGraphics)
      implementation(Dependencies.composeUiToolingPreview)
}

fun DependencyHandler.hilt(){
      implementation(Dependencies.hiltAndroid)
      kapt(Dependencies.hiltCompiler)
}